package cn.itsource.hbc.org.service.impl;

import cn.itsource.hbc.org.domain.Systemdictionarydetail;
import cn.itsource.hbc.org.domain.Systemdictionarytype;
import cn.itsource.hbc.org.mapper.SystemdictionarydetailMapper;
import cn.itsource.hbc.org.query.SystemdictionarydetailQuery;
import cn.itsource.hbc.org.query.SystemdictionarytypeQuery;
import cn.itsource.hbc.org.service.ISystemdictionarydetailService;
import cn.itsource.utils.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public class SystemdictionarydetailServiceImpl implements ISystemdictionarydetailService {

    @Autowired
    private SystemdictionarydetailMapper systemdictionarydetailMapper;

    @Override
    @Transactional
    public void save(Systemdictionarydetail systemdictionarydetail) {
        systemdictionarydetailMapper.save(systemdictionarydetail);
    }

    @Override
    @Transactional
    public void update(Systemdictionarydetail systemdictionarydetail) {
        systemdictionarydetailMapper.update(systemdictionarydetail);

    }

    @Override
    @Transactional
    public void delete(Long id) {
        systemdictionarydetailMapper.delete(id);
    }

    @Override
    public Systemdictionarydetail loadById(Long id) {
        return systemdictionarydetailMapper.loadById(id);
    }

    @Override
    public List<Systemdictionarydetail> loadAll() {
        return systemdictionarydetailMapper.loadAll();
    }

    @Override
    @Transactional
    public PageResult<Systemdictionarydetail> queryPage(SystemdictionarydetailQuery query) {
        Long total=systemdictionarydetailMapper.count(query);
        if (total==null||total==0){
            return new PageResult<>();
        }
        List<Systemdictionarydetail> list=systemdictionarydetailMapper.page(query);

        return new PageResult<>(list,total);
    }

    @Override
    @Transactional
    public void allDelete(Long[] ids) {
        systemdictionarydetailMapper.allDelete(ids);
    }
}
